package com.ugoodtech.mdcc.core.domain;

/* Copyright (C) Ugoodtech, Inc - All Rights Reserved.
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 * Proprietary and confidential.
 * Written by Stone Shaw.
 */
//@ApiModel("中国区")
//public enum ChinaDistrict {
//    NORTH_CHINA("华北", 1), NORTHEAST("东北", 2),
//    EAST_CHINA("华东", 3), SOUTH_CHINA("华南(华中)", 4),
//    SOUTHWEST("西南", 5), NORTHWEST("西北", 6);
//
//    private String name;
//    private Integer code;
//
//    ChinaDistrict(String name, Integer code) {
//        this.name = name;
//        this.code = code;
//    }
//
//    public String getName() {
//        return name;
//    }
//
//    public Integer getCode() {
//        return code;
//    }
//}


import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import javax.persistence.*;
import java.util.List;

@ApiModel("中国区")
@Entity
@Table(name = "china_district")
public class ChinaDistrict extends BaseEntity{
    @ApiModelProperty("分区编号")
    private String code;
    @ApiModelProperty("分区名称")
    private String name;
    @ApiModelProperty("包含省")
    private List<Nation> nationList;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
         }

    public void setName(String name) {
        this.name = name;
    }


    @JsonIgnore
    @ManyToMany(fetch = FetchType.EAGER)
    @Fetch(FetchMode.SELECT)
    @JoinTable(
            name = "china_district_nation",
            joinColumns = {@JoinColumn(name = "china_district_id")},
            inverseJoinColumns = @JoinColumn(name = "nation_id")
    )
    public List<Nation> getNationList() {
        return nationList;
    }

    public void setNationList(List<Nation> nationList) {
        this.nationList = nationList;
    }
}
